import java.lang.reflect.Array;
import java.util.Arrays;

import org.omg.CORBA.PUBLIC_MEMBER;


public class Loops {

		public static void main(String[] args) {
		
			String wordToCrypt = "banana";
			char[] wordAsCharArr = wordToCrypt.toCharArray();
			char[] cryptedWord = new char[wordAsCharArr.length];
			char[][] keyArr = {
					{'b', 'q', 'l', 'c', 's'},
					{'d', 'a', 'm', 'd', 'x'},
					{'g', 'n', 'f', 'y', 'p'},
					{'t', 'u', 'w', 'r', 'v'},
			};

		
			for (int i = 0; i < wordAsCharArr.length; i++) {
				if(wordAsCharArr[i]%2 == 0) {
					int indexOfCols = findIndexfOfCols(wordAsCharArr[i], keyArr);
					System.out.println(indexOfCols);
					//int indexOfRows = findIndexfOfRows(wordAsCharArr[i], keyArr);
					//System.out.println(keyArr[indexOfRows][indexOfCols]);
				} else{}
			}
			
			

		}
			
		
		
		public static int findIndexfOfCols(char ch, char[][] matrix) {
			int rows = matrix.length;
			 int cols = matrix[0].length;
			 int indexCols = 0; 
			 
			for (int i = 0; i < rows; i++) {
			for (int j = 0; j < cols; j++) {
					if(matrix[rows][cols] == ch) {
						indexCols = cols;
						
					} else {
						indexCols = -1;
					}
				}
			}
			return indexCols;
		}
		
		public static int findIndexfOfRows(char ch, char[][] matrix) {
			int rows = matrix.length;
			 int cols = matrix[0].length;
			 int indexRows = 0; 
			 
			for (int i = 0; i < rows; i++) {
			for (int j = 0; j < cols; j++) {
					if(matrix[rows][cols] == ch) {
						indexRows = rows;
						
					} else {
						indexRows = -1;
					}
				}
			}
			return indexRows;
		}

	}


